<?php
/*
 * 测试添加栏目
 * Created on 2013-8-9
 */
ini_set('display_errors',1);
include_once dirname(dirname(__FILE__)).'/mgtv_init.php';
include_once dirname(dirname(__FILE__)).'/yntt/init.php';

$action = isset($_GET['action'])?$_GET['action']:'add';
	$cate_array = array(
	);
	$cate_array[] = array('nns_category_id'=>'20000','nns_parent_id'=>'0','nns_name'=>'芒果TV');
	/*$cate_array[] = array('nns_category_id'=>'10000001','nns_parent_id'=>'10000','nns_name'=>'电影');
	$cate_array[] = array('nns_category_id'=>'10000002','nns_parent_id'=>'10000','nns_name'=>'连续剧');
	$cate_array[] = array('nns_category_id'=>'10000003','nns_parent_id'=>'10000','nns_name'=>'综艺');
	$cate_array[] = array('nns_category_id'=>'10000004','nns_parent_id'=>'10000','nns_name'=>'音乐');
	$cate_array[] = array('nns_category_id'=>'10000005','nns_parent_id'=>'10000','nns_name'=>'动漫');
	$cate_array[] = array('nns_category_id'=>'10000006','nns_parent_id'=>'10000','nns_name'=>'纪实');
	$cate_array[] = array('nns_category_id'=>'10000007','nns_parent_id'=>'10000','nns_name'=>'回看');
	$cate_array[] = array('nns_category_id'=>'10000008','nns_parent_id'=>'10000','nns_name'=>'时移');
	$cate_array[] = array('nns_category_id'=>'10000009','nns_parent_id'=>'10000','nns_name'=>'轮播');
	$cate_array[] = array('nns_category_id'=>'10000010','nns_parent_id'=>'10000','nns_name'=>'首页推荐');
	$cate_array[] = array('nns_category_id'=>'10000011','nns_parent_id'=>'10000','nns_name'=>'专题');
	$cate_array[] = array('nns_category_id'=>'10000012','nns_parent_id'=>'10000','nns_name'=>'专区');
	$cate_array[] = array('nns_category_id'=>'10000999','nns_parent_id'=>'10000','nns_name'=>'未分类');*/
if($action=='add'){

	
	foreach($cate_array as $item){
		c2_task_model::add_categoy( $item);
	}
	/*
	$category_info = array(
	'nns_name'=>'芒果TV',
	'nns_category_id'=>'10000',
	'nns_parent_id'=>'0',
	);
	c2_task_model::add_categoy( $category_info);
	*/	
}else if($action=='del'){

	foreach($cate_array as $item){
		if($item['nns_category_id'] == '20000') continue;
		$category_info = array(
		'nns_id'=>$item['nns_category_id'],
		);			
		c2_task_model::delete_category( $category_info);	
	}	
}



echo 'OK';
